Close a race when statting and reading files.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Jan 2013 05:12:08 +0000 (21:12 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Jan 2013 05:12:08 +0000 (21:12 -0800)
commitc2984f993d538bd03c08235e194b01589a666a84
tree507982b62b1939e010a926ad466e80ab53d30b08
parent9c45350ec1f0cf40ca7dc2630e33c0d8d7b89498
Close a race when statting and reading files.

* fileio.c (Finsert_file_contents): Use open+fstat, not stat+open.
This avoids a race if the file is renamed between stat and open.
This race is not the problem originally noted in Bug#13149;
see <http://bugs.gnu.org/13149#73> and later messages in the thread.
src/ChangeLog
src/fileio.c